<!DOCTYPE html>
<title>Test that media file is not reloaded when an element is inserted into the DOM.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<div id="parent"></div>
<script>
async_test(function(t) {
    var audio = document.createElement("audio");

    audio.oncanplaythrough = t.step_func(function() {
        audio.onloadstart = t.unreached_func("Should not fire 'loadstart' event");
        document.getElementById("parent").appendChild(audio);
        audio.play();
    });

    audio.onplaying = t.step_func_done();
    audio.onloadstart = t.step_func(function() {});
    audio.ondurationchange = t.step_func(function() {});
    audio.onplay = t.step_func(function() {});
    audio.onloadeddata = t.step_func(function() {});

    audio.src = "content/test.oga";
    audio.load();
})
</script>